package com.zaprk.controller;

import com.zaprk.pojo.Person;
import com.zaprk.service.IPersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @PackageName: com.zaprk.controller
 * @ClassName: PersonController
 * @Description:
 * @author: RZS
 * @date: 2024/3/11  11:30
 */
@RestController
@RequestMapping("/per")
public class PersonController {

    @Autowired
    private IPersonService personService;

    // 服务器内部错误（代码逻辑错误）
    @RequestMapping("/t1")
    public String t1(){
        return personService.number();
    }

    // 服务器内部错误（操作数据库结果错误问题）
    @RequestMapping("/t2/{id}")
    public Person t2(@PathVariable Integer id){

        return personService.findById(id);
    }
}
